<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* flex 实现子元素在父元素中居中对齐*/
    /* .father {
      display: flex;
      width: 300px;
      height: 300px;
      justify-content: center;
      align-items: center;
      background-color: blue;
    } */

    img {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      background-color: pink;
    }

    /* 宽度不知的话 */
    img {}
  </style>
</head>

<body>
  <div class="father">
    <img src="man.jpg"></img>
  </div>
</body>

</html>